package com.jt.demo4.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class SpringAOP {

@Pointcut("@annotation(com.jt.demo4.anno.CGB2110)")
    public void pointcut(){}
//@Before("pointcut()")
public  void    before(JoinPoint joinPoint){
    System.out.println("我是前置通知");
}
//@AfterReturning(value = "pointcut()",returning = "result")//后置通知
public void afterReturn(JoinPoint joinPoint,Object result){
    System.out.println("后置通知,获取方法名称"+result);
}
@AfterThrowing(value = "pointcut()",throwing = "exception")//异常通知
    public void findU(JoinPoint joinPoint,Exception exception){
exception.printStackTrace();
    System.out.println("我是异常通知");

}
}
